package org.example.Command;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

@AllArgsConstructor
@NoArgsConstructor
@Data
public abstract class Command extends Message implements Serializable {
    private static final long serialVersionUID = 2L;

    /**
     * 原始指令
     */
    String commandStr;

    /**
     * 指令map
     */
    HashMap<String, String> args;

    public Command(String commandStr, HashMap<String, String> args, Integer type) {
        super(type, 0);
        this.commandStr = commandStr;
        this.args = args;
    }
    public Command(String commandStr, HashMap<String, String> args, Integer type,Integer SequenceId) {
        super(type, SequenceId);
        this.commandStr = commandStr;
        this.args = args;
    }

    /**
     * 检查指令正确性
     *
     * @throws Exception
     */
    public abstract void check() throws Exception;
}
